$modalMargin: 2rem;

.pm_modal-hidden { display: none !important }
.pm_modal {
    position: absolute;
    z-index: 99998;
    display: block;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    iframe {
        width: 100%;
    }
    .angular-squire-wrapper {
        border: 1px solid $border;
        border-top: none;
    }
    &.domains {
        .modal-dialog {
            .modal-content {
                .modal-body {
                    box-shadow: inset 0 1px 0 $border, inset 0 -1px 0 $border;
                    z-index: 2;
                }
            }
        }
    }
    &.important {
        z-index: 99999;
    }
    &.very-important {
        z-index: 100000;
    }
    &.small {
        .modal-dialog {
            width: 30rem;
            max-width: 100%;
            bottom: initial !important;
            margin-left: -15rem;
            .modal-content {
                .modal-header,
                .modal-body {
                    padding: ($modalMargin/2) $modalMargin;
                }
            }
            .modal-footer {
                clear: both;
                padding: ($modalMargin/2) $modalMargin;
            }
        }
    }
    .modal-overlay {
        content: "";
        display: block;
        position: fixed;
        left: 0;
        top: 0;
        right: 0;
        bottom: 0;
        z-index: 1;
        background: rgba(0,0,0,.2);
        pointer-events: none;
    }
    .modal-dialog {
        position: relative;
        z-index: 2;
        background: $white;
        left: 50%;
        width: 48rem;
        margin-top: 3rem;
        margin-bottom: 3rem;
        margin-left: -24rem;
        border: 5px solid $primary;
        .close {
            position: absolute;
            right: -5px;
            top: -5px;
            width: 25px;
            height: 25px;
            line-height: 25px;
            text-align: center;
            padding: 0;
            color: $white;
            background: $primary;
            cursor: pointer;
            display: block;
            border: none;
            z-index: 9999;
        }

        .modal-content {
            background: $white;
            .modal-header {
                padding: ($modalMargin/2) $modalMargin;
            }
            .modal-body {
                padding: ($modalMargin/2) $modalMargin;
                box-shadow: inset 0 1px 0 $border, inset 0 -1px 0 $border;
                clear: both;
                zoom: 1;
                width: 100%;
            }
        }
        .modal-footer {
            clear: both;
            padding: ($modalMargin/2) $modalMargin;
            background-color: $white;
            display: flex;
            justify-content: space-between;
        }

        .modal-footer .modal-footer-button:only-child {
            margin-left: auto;
        }

        .modal-footer .modal-footer-button + .modal-footer-button {
            margin-left: auto
        }

        .modal-content {
            h1, h2, h3, h4 {
                font-size: 22px;
                line-height: 36px;
                font-weight: 400;
                color: $text;
                text-overflow: ellipsis;
                overflow: hidden;
                em {
                    font-style: normal;
                    color: $gray;
                }
            }
            .clearfix {
                padding: 5px;
                margin: 0 -5px;
            }
        }
    }

    .modal-details {
        border: 1px solid $border;
        margin: 0 0 .4em;
    }

    .modal-summary {
        font-size: 1.1em;
        font-weight: bold;
        cursor: pointer;
        padding: 1em;
    }

    .modal-content-details {
        padding: 0 1em;
    }
}

.confirm-warning-icon {
    color: indianred;
}

.pm_modal.small + .pm_modal:not(.small) { z-index: 9990; }

body.appConfigBody-is-mobile {

    .pm_modal {
        &.small {
            .modal-dialog {
                width: 50%;
                bottom: initial !important;
                margin-left: -25%;
                left: 50%;
                top: 2rem;
            }
        }
        .modal-dialog {
            position: absolute;
            z-index: 2;
            background: $white;
            left: 0;
            right: 0;
            top: 0;
            width: 100%;
            margin: 0;
            border: none;
            .close {
                top: 0;
                right: 0;
                height: 3rem;
                line-height: 3rem;
                width: 3rem;
                background-color: transparent;
                color: $default-color;
            }
            .modal-content {
                top: 3rem;
            }
        }
    }
}

body.appConfigBody-is-mobile {
    .pm_modal {
        &.small {
            .modal-dialog {
                width: 100%;
                bottom: initial !important;
                margin-left: 0;
                left: 0;
                top: 0;
            }
        }
    }
}
